package com.zhangkeyou.map.mapweb.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhangkeyou.map.mapweb.domain.entity.Feature;
import com.zhangkeyou.map.mapweb.domain.entity.Features;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface FeaturesMapper extends BaseMapper<Features> {
//    @Insert("insert into features(name,fields,geometry) values(#{geometryType},#{fields},'geometry')")
//    public int insertTo (Features features);

    public Features getFeaturesById(String id);



    public int insertFeatures(Features features);

//    @Insert("insert into feature values(#{id},#{featureId},#{featuresId},#{attributes},#{parentId},#{name},null,null)")
    public int insertFeature(Feature feature);

    public Features getFeaturesInfo(@Param("level") int level,@Param("parentId") String parentId);

    public Feature getFeatureWithGeometryByFeatureId(@Param("featureId")String featureId);

    // 获取featureList
    List<Features> getFeaturesListByLevelAndParentId(@Param("level") int level, @Param("parentId") String parentId);


    List<Feature> getFeatureByLevelId(@Param("level") int level, @Param("id")  String id);

    void delete(Features features);

    Features selectByFeaturesNameAndLevel(Features features);

    int updateFeaturesByFeaturesId(@Param("features") Features features, @Param("id") String id);

    void updateFeatureByFeatureId(@Param("feature") Feature feature,@Param("featureId") String featureId);

    List<Features> getFirstLevelFeatures();

    List<Feature> getFeatureListByLevelAndFeaturesId(@Param("level") int level,@Param("featuresId") String featuresId);

    List<Feature> getFeatureListByLevelAndParentId(@Param("level") int level,@Param("parentId") String parentId);

    int deleteFeatureByFeatureId(@Param("featureId") String featureId);

    Feature getFeatureByFeatureIdWithoutGeometry(@Param("featureId") String featureId);

    List<Feature> getFeaturesListByFeaturesIdWithoutGeometry(@Param("featuresId") String featuresId);

    int deleteFeaturesById(@Param("id") String id);

    List<String> getAllFeaturesId();

    int getFeatureCountByFeaturesId(@Param("featuresId") String featuresId);
}
